package net.zoneland.knowledge.config;

import java.util.List;
import java.util.Optional;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import com.google.common.collect.Lists;

/**
 * .
 *
 * @author: bcc
 * 2021/7/14
 */
@Configuration
@ConfigurationProperties("biz")
public class BizConfig {

    /**
     * 最大每页条数.
     */
    public static final int MAX_PAGE_SIZE = 500;

    /**
     * 认证方式.
     */
    private String authMethod;

    /**
     * 是否需要管理员审批.
     */
    private boolean needAdminApprove;

    private List<String> provinceAdminRole = Lists.newArrayList("provinceHRAdmin");

    private List<String> cityAdminRole = Lists.newArrayList("cityHRAdmin");

    private List<String> hrAdminRole = Lists.newArrayList("provinceHRAdmin", "cityHRAdmin");

    /**
     * 超级维护员可以查看所有.
     */
    private List<String> adminRole = Lists.newArrayList("admin");
    /**
     * 纠错管理员可以查看所有.
     */
    private List<String> errorCorrectAdminRole = Lists.newArrayList("ErrorCorrectAdmin");

    /**
     * .
     *
     * @return provinceAdminRole
     */
    public List<String> getProvinceAdminRole() {
        return Optional.ofNullable(provinceAdminRole).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @param provinceAdminRole to set
     */
    public void setProvinceAdminRole(final List<String> provinceAdminRole) {
        this.provinceAdminRole = Optional.ofNullable(provinceAdminRole).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @return cityAdminRole
     */
    public List<String> getCityAdminRole() {
        return Optional.ofNullable(cityAdminRole).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @param cityAdminRole to set
     */
    public void setCityAdminRole(final List<String> cityAdminRole) {
        this.cityAdminRole = Optional.ofNullable(cityAdminRole).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @return adminRole
     */
    public List<String> getAdminRole() {
        return Optional.ofNullable(adminRole).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @param adminRole to set
     */
    public void setAdminRole(final List<String> adminRole) {
        this.adminRole = Optional.ofNullable(adminRole).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @return onlineLearnUrl
     */
    public List<String> getHrAdminRole() {
        return Optional.ofNullable(hrAdminRole).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }
    /**
     * .
     *
     * @param hrAdminRole to set
     */
    public void setHrAdminRole(final List<String> hrAdminRole) {
        this.hrAdminRole = Optional.ofNullable(hrAdminRole).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }
    /**
     * .
     *
     * @return errorCorrectAdminRole
     */
    public List<String> getErrorCorrectAdminRole() {
        return Optional.ofNullable(errorCorrectAdminRole).map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }
    /**
     * .
     *
     * @param errorCorrectAdminRole to set
     */
    public void setErrorCorrectAdminRole(final List<String> errorCorrectAdminRole) {
        this.errorCorrectAdminRole = Optional.ofNullable(errorCorrectAdminRole)
            .map(it -> Lists.newArrayList(it.iterator())).orElse(null);
    }

    /**
     * .
     *
     * @return authMethod
     */
    public String getAuthMethod() {

        return authMethod;
    }

    /**
     * .
     *
     * @param authMethod to set
     */
    public void setAuthMethod(final String authMethod) {

        this.authMethod = authMethod;
    }

    public boolean isNeedAdminApprove() {

        return needAdminApprove;
    }

    /**
     * 设置 needAdminApprove.
     *
     * @param needAdminApprove needAdminApprove
     */
    public void setNeedAdminApprove(final boolean needAdminApprove) {

        this.needAdminApprove = needAdminApprove;
    }

}
